package com.zcxy.fast.config;

import io.minio.MinioClient;
import io.minio.errors.InvalidEndpointException;
import io.minio.errors.InvalidPortException;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zcc
 * @version 1.0.0
 * @ClassName MinoClientConfig.java
 * @Description TODO
 * @createTime 2020年06月30日 10:12:00
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "minio")
public class MinoClientConfig {
    private String url;
    private String username;
    private String password;

    @Bean
    public MinioClient minioClient(MinoClientConfig minoClientConfig) throws InvalidPortException, InvalidEndpointException {
        MinioClient client = new MinioClient(minoClientConfig.getUrl(), minoClientConfig.getUsername(), minoClientConfig.getPassword());
        return client;
    }

}
